home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / misc / math / gpamiga_1_38_3.lha / examples / EXPLAIN < prev    next >
Encoding:
Text File  |  1993-11-01  |  3.2 KB  |  72 lines

  1. Several examples of complete and non-trivial GP programs are given in this
  2. directory (as well as the C program mattrans.c using the Pari library described
  3. in Chapter 4 of the users' manual). This file gives a brief description of
  4. these programs. All these programs should be read into GP by the command
  5. \r file.
  6.  
  7. 1) bench.gp
  8.  
  9. This program computes the first 1000 terms of the Fibonacci sequence, the
  10. product p of successive terms, and the lowest common multiple q. It outputs
  11. the ratio log(p)/log(q) every 10 terms (this ratio tends to pi^2/6 as k
  12. tends to infinity). The name bench.gp comes from the fact that this program
  13. is one (among many) examples where GP/PARI performs orders of magnitude
  14. faster than systems such as Maple or Mathematica (try it!).
  15.  
  16. 2) clareg.gp
  17.  
  18. Written entirely in the GP language without using the function buchgen,
  19. the programs included in this file allow you in many cases to compute the 
  20. class number, the structure of the class group and a system of fundamental 
  21. units of a general number field (this programs sometimes fails to give an
  22. answer). It can work only if initalg finds a power basis.
  23. Evidently it is much less powerful and much slower than the function
  24. buchgen, but it is given as an example of a sophisticated use of GP.
  25. The first thing to do is to call the function clareg(pol,limp,lima,extra)
  26. where pol is the monic irreducible polynomial defining the number field, limp
  27. is the prime factor base limit (try values between 19 and 113), lima is 
  28. another search limit (try 50 or 100) and extra is the number of desired extra
  29. relations (try 2 to 10). The program prints the number of relations that it 
  30. needs, and tries to find them. If you see that clearly it slows down too much
  31. before succeeding, abort and try other values. If it succeeds, it will print 
  32. the class number, class group, regulator. These are tentative values. Then
  33. use the function check(lim) (take lim=200 for example) to check if the value 
  34. is consistent with the value of the L-series (the value returned by check 
  35. should be close to 1). Finally, the function fu() (no parameters) returns a
  36. family of units which generates the unit group (you must extract a system
  37. of fundamental units yourself).
  38.  
  39. 3) lucas.gp
  40.  
  41. The half line function lucas(p) defined in this file performs the Lucas-Lehmer
  42. primality test on the Mersenne number 2^p-1. If the result is 1, the Mersenne
  43. number is prime, otherwise not.
  44.  
  45. 4) rho.gp
  46.  
  47. A simple implementation of Pollard's rho method. The function rho(n) outputs
  48. the complete factorization of n in the same format as factor.
  49.  
  50. 5) squfof.gp 
  51.  
  52. This defines a function squfof of a positive integer variable n, which may
  53. allow you to factor the number n. SQUFOF is a very nice factoring
  54. method invented in the 70's by D. Shanks for factoring integers, and is 
  55. reasonably fast for numbers having up to 15 or 16 digits. The squfof program
  56. which is given is a very crude implementation. It also prints out some
  57. intermediate information as it goes along. The final result is some factor of
  58. the number to be factored.
  59.  
  60. 6) tutnf.gp
  61.  
  62. This is the sequence of GP instructions given in the tutorial in the section
  63. on general number fields.
  64.  
  65. 7) tutnfout
  66.  
  67. This is the slightly edited output of running tutnf.gp (obtained by removing
  68. the ? at the beginning of each command for more legibility).
  69.  
  70.  
  71.  
  72.